/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gardenmaker;

/**
 *
 * @author Leonardo Lino
 */

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Area;
import java.awt.geom.Rectangle2D;
import static java.lang.Math.*;

    
    public class TuboVertical extends Forma {
    
    private Rectangle2D.Double rect;
  
    
    public TuboVertical(int x, int y, String name) {
        super(x, y, name);
        altura= 50;
        largura = 10;
        
        jprop.setTHeight(altura);
        jprop.setTWidth(largura);
        jprop.setEnableAltura(true);
        jprop.setEnableLargura(false);
       
        rect = new Rectangle2D.Double(this.x, this.y, largura, altura);
        
        
        formaArea = new Area(rect);
        selectionSquare();
    }
     
    @Override
    public void setXY(int x, int y) {
        int newX = x - this.x;
        int newY = y - this.y;
        this.x = x;
        this.y = y;
        rect.x=x;
        rect.y=y;
        formaArea = new Area(rect);
        selectionSquare();
    }

    @Override
    public void setAltura(int a) {
        
    }

    @Override
    public void setLargura(int l) {
        
        if(largura==l) return;
        rect.width = l;
        largura = l;
        
        selectionSquare();
    }

    @Override
    public void desenhar(Graphics g) {

        Graphics2D g2 = (Graphics2D) g;
        
        
         if (rotacao != 0) {
            double r = toRadians(rotacao);
            g2.rotate(r);
        }
        g2.setColor (Color.BLACK);
        g2.draw(rect);
        //g2.drawImage(img, x, y, largura, altura, null);
    }
    
    @Override
    public void desenharSelBox(Graphics g) {
        Graphics2D g2 = (Graphics2D) g;
        selectionSquare();
        g2.setColor(Color.GREEN);
        g2.draw(selBox);
        g2.setColor(Color.BLACK);
        
    }
    
    
    @Override
    public void setArea(Area ar){
       this.formaArea=ar; 
    }
    
    @Override
    public Area getArea(){
        return formaArea;
    }
    
}
